package com.liqi.system.service.impl.device;

import com.liqi.common.annotation.DataScope;
import com.liqi.common.config.Sm4TypeHandler;
import com.liqi.common.utils.DateUtils;
import com.liqi.deployment.domain.DvOperationUser;
import com.liqi.system.mapper.DvOperationUserMapper;
import com.liqi.system.service.device.IDvOperationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 运维人员信息Service业务层处理
 *
 * @author Lwy
 * @date 2022-02-16
 */
@Service
public class DvOperationUserServiceImpl implements IDvOperationUserService
{
    @Autowired
    private DvOperationUserMapper dvOperationUserMapper;

    /**
     * 查询运维人员信息
     *
     * @param id 运维人员信息主键
     * @return 运维人员信息
     */
    @Override
    public DvOperationUser selectDvOperationUserById(Long id)
    {
        return dvOperationUserMapper.selectDvOperationUserById(id);
    }

    @Override
    public DvOperationUser selectDvOperationUserByCode(String operationUserCode) {
        return dvOperationUserMapper.selectDvOperationUserByCode(operationUserCode);
    }

    @Override
    public DvOperationUser selectDvOperationUserByOperationUserName(String operationUserName,String operationUserCode) {
        return dvOperationUserMapper.selectDvOperationUserByOperationUserName(operationUserName,operationUserCode);
    }

    /**
     * 查询运维人员信息列表
     *
     * @param dvOperationUser 运维人员信息
     * @return 运维人员信息
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<DvOperationUser> selectDvOperationUserList(DvOperationUser dvOperationUser)
    {
        return dvOperationUserMapper.selectDvOperationUserList(dvOperationUser, Sm4TypeHandler.KEY);
    }

    /**
     * 新增运维人员信息
     *
     * @param dvOperationUser 运维人员信息
     * @return 结果
     */
    @Override
    public int insertDvOperationUser(DvOperationUser dvOperationUser)
    {
        dvOperationUser.setCreateTime(DateUtils.getNowDate());
        dvOperationUser.setStatus(0);
        return dvOperationUserMapper.insertDvOperationUser(dvOperationUser);
    }

    /**
     * 修改运维人员信息
     *
     * @param dvOperationUser 运维人员信息
     * @return 结果
     */
    @Override
    public int updateDvOperationUser(DvOperationUser dvOperationUser)
    {
        dvOperationUser.setUpdateTime(DateUtils.getNowDate());
        return dvOperationUserMapper.updateDvOperationUser(dvOperationUser);
    }

    /**
     * 批量删除运维人员信息
     *
     * @param ids 需要删除的运维人员信息主键
     * @return 结果
     */
    @Override
    public int deleteDvOperationUserByIds(Long[] ids)
    {
        return dvOperationUserMapper.deleteDvOperationUserByIds(ids);
    }

    /**
     * 删除运维人员信息信息
     *
     * @param id 运维人员信息主键
     * @return 结果
     */
    @Override
    public int deleteDvOperationUserById(Long id)
    {
        return dvOperationUserMapper.deleteDvOperationUserById(id);
    }

    @Override
    public int tombstoneOperationUser(Long[] ids) {
        return dvOperationUserMapper.tombstoneOperationUser(ids);
    }

    @Override
    public List<DvOperationUser> selectDvOperationUserListForDevice(DvOperationUser dvOperationUser) {
        return dvOperationUserMapper.selectDvOperationUserListForDevice(dvOperationUser);
    }

    @Override
    public List<DvOperationUser> selectDvOperationUserByNameOrPhone(DvOperationUser dvOperationUser) {
        return dvOperationUserMapper.selectDvOperationUserByNameOrPhone(dvOperationUser);
    }


}
